sh_dir=$(dirname $(realpath $0))

#多GPU时需要设为1结果才能正确，单GPU时设为0速度能够更快
USE_TO_CPU=0

GPU_INFO=$(lspci | grep -i nvidia)

if [[ $GPU_INFO == *"GeForce GTX 1060"* ]]; then
    #1060
    GPU_CC=61
elif [[ $GPU_INFO == *"NVIDIA Corporation Device 2684"* ]]; then
    #4090
    GPU_CC=89
elif [[ $GPU_INFO == *"Tesla T4"* ]]; then
    #T4
    GPU_CC=75
elif [[ $GPU_INFO == *"GeForce GTX 1660"* ]]; then
    #1660
    GPU_CC=75
fi
echo $GPU_CC

################################################################################################################
cd ${sh_dir}/slide_win_crop_image_cu
mkdir -p build
cd build
cmake -DCMAKE_INSTALL_PREFIX:PATH=`pwd`/install -DGPU_CC=${GPU_CC} -DUSE_TO_CPU=${USE_TO_CPU} ..
make -j16
make install
################################################################################################################

#copy .so
cp ${sh_dir}/slide_win_crop_image_cu/build/*.so ${sh_dir}/../server/model_repo/slide_win_crop_image_cu/1
